Skip to content

Conversation

@dianne
Copy link
Contributor

@dianne dianne commented Nov 3, 2025

The section on * operators states that an overloaded *x is equivalent in immutable place expression contexts to *std::ops::Deref::deref(&x) and that it is equivalent in mutable place expression contexts to *std::ops::DerefMut::deref_mut(&mut x). That isn't quite true for their temporary scopes, so this PR adds a note including an example where the difference affects static semantics.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Nov 3, 2025
@dianne
Copy link
Contributor Author

dianne commented Nov 4, 2025

The sections on field access expressions and tuple indexing expressions may also benefit from similar examples or links to that example, since autoderef means they're also affected by this behavior. The autoderef section on the field access expressions page doesn't contradict it, at least. The tuple indexing expressions section doesn't account for autoderef at all, so it will need to be reworked first.

@dianne

This comment was marked as resolved.

@rustbot rustbot added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: The marked PR is awaiting review from a maintainer labels Nov 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@dianne dianne force-pushed the deref-desugar-scoping-difference branch from d8c164b to ddc1d58 Compare November 4, 2025 08:22
@dianne
Copy link
Contributor Author

dianne commented Nov 4, 2025

@rustbot ready

I'll open a separate PR to add text for Box to the * operator expression documentation.

@rustbot rustbot added S-waiting-on-review Status: The marked PR is awaiting review from a maintainer and removed S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. labels Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants